package com.hhkj.study.admin.article.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * @Author luowu
 * @Date 2024/9/11 涵 16:46:45
 */
@Getter
public enum BannerEnum {

    /**
     * banner位置
     */
    COURSE_INDEX("courseIndexCode", "首页"),

    COURSE_CENTER("courseCenterCode", "课程中心"),

    ;
    private String code;

    private String desc;

    BannerEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(String code) {
        for (BannerEnum item : BannerEnum.values()) {
            if (StrUtil.equalsIgnoreCase(item.getCode(), code)) {
                return item.getDesc();
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return code;
    }
}
